package com.andyage.admin.action;

import javax.annotation.Resource;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;

import com.andyage.admin.bean.AdorderBean;
import com.andyage.admin.service.IAdorderCountService;
import com.andyage.util.DateUtil;

@Controller
@RequestMapping("/admin")
public class AdorderCountAction {
	@Resource
	private IAdorderCountService iadorderCountService;
	
	@RequestMapping("/queryOrderPriceCount")
	public void queryOrderPriceCount(HttpServletRequest request,HttpServletResponse response) {
		AdorderBean order = new AdorderBean();
		String startDate = request.getParameter("sstartDate");
		String endDate = request.getParameter("sendDate");
		if(startDate!=null&&!"".equals(startDate)){
			order.setStartDate(DateUtil.getDate(startDate, "yyyy-MM-dd"));
		}
		if(endDate!=null&&!"".equals(endDate)){
			order.setEndDate(DateUtil.getDate(endDate, "yyyy-MM-dd"));
		}
		try {
			String json = iadorderCountService.queryAllOrderPriceSumByDateTime(order);
			response.setContentType("text/html;charset=UTF-8");
			response.getWriter().print(json);
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}
